<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>逛水果店</title>
  </head>
  <body>
    <div id="app">
      <p>欢迎光临_vue开发的收银系统_水果店</p>
      <p>苹果 10 ￥ / 斤，折扣< 8折 ></p>
      <p>请输入你要购买的斤数<input v-model="username" type="text" /></p>
      <button @click="fn">结账买单~</button>
      <p>
        结账单：总价：{{money1}} ￥元 折后价：{{money2}}￥元
        省了：{{money3}}￥元
      </p>
    </div>
    <script src="./vue.js"></script>
    <script>
      const app = new Vue({
        el: '#app',
        data: {
          username: '',
          money1: 0,
          money2: 0,
          money3: 0
        },
        methods: {
          fn() {
            this.money1 = this.username * 10
            this.money2 = this.username * 8
            this.money3 = this.username * 2
          }
        }
      })
    </script>
  </body>
</html>
